
<%@ page contentType="text/html;charset=UTF-8" language="java" import="java.util.*" %>
<%@ page import="entity.*" %>
<%@ page import="dao.*" %>
<%@ page import="dao.impl.*" %>
<%
    BoardDao boardDao = new BoardDaoImpl();		//得到板块Dao的实例
    int boardID = Integer.parseInt(request.getParameter("boardID"));
    Board board = boardDao.findBoard(boardID);		//取得板块信息

%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <title>表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="css/topbar.css">
    <link rel="stylesheet" href="css/list.css">
    <link rel="stylesheet" href="layui/css/layui.css">
</head>
<body>
<div class="main">
    <div class="top">
        <label>校园BBS系统</label>
    </div>
    <%
        if(session.getAttribute("user") == null){
    %>
    <div class="bar"><p>您尚未
        <a href="login.jsp" target="_blank">登录</a>&nbsp;|
        <a href="register.jsp" target="_blank">注册</a>
    </p>
    </div>
    <%
    }
    else{
        User loginUser = (User)session.getAttribute("user");
    %>
    <p class ="bar">
        您好：<%= loginUser.getUName() %>&nbsp;|&nbsp;
        <a href ="login.jsp" target="_blank">登出</a>
    </p>
    <%	} %>
    </div>
    <div class="crumbs">
        	<span class="layui-breadcrumb">
  				<a href="index.jsp"><i class="layui-icon layui-icon-home"></i>&nbsp;论坛主页</a>
                <a href ="list.jsp?page=1&boardID=<%= boardID %>"><i class="layui-icon layui-icon-read"></i>&nbsp;<%= board.getBoardName() %></a>
<%--  				<a href=""><i class="layui-icon layui-icon-read"></i>&nbsp;c语言</a>--%>
  				<a><cite>发表文章</cite></a>
			</span>
    </div>
    <div class="form-set">
        <form class="layui-form" style="width: 1100px;margin-left:160px;padding-top: 20px;padding-bottom:20px;background:rgba(226, 238, 214,0.6);" method="post" action="PostServlet">
            <div class="layui-form-item" style="padding-left: 200px">
                <label class="layui-form-label">标题</label>
                <div class="layui-input-block">
                    <input type="text" name="title" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input" style="width: 500px">
                </div>
                <input type="hidden" name="boardID" value=<%= boardID %>>
            </div>

<%--            <div class="layui-form-item" style="padding-left: 200px">--%>
<%--                <label class="layui-form-label">选择框</label>--%>
<%--                <div class="layui-input-inline" style="width: 245px">--%>
<%--                    <select name="quiz1">--%>
<%--                        <option value="">请选择省</option>--%>
<%--                        <option value="浙江" selected="">浙江省</option>--%>
<%--                        <option value="你的工号">江西省</option>--%>
<%--                        <option value="你最喜欢的老师">福建省</option>--%>
<%--                    </select>--%>
<%--                </div>--%>
<%--                <div class="layui-input-inline" style="width: 245px">--%>
<%--                    <select name="quiz2">--%>
<%--                        <option value="">请选择市</option>--%>
<%--                        <option value="杭州">杭州</option>--%>
<%--                        <option value="宁波" disabled="">宁波</option>--%>
<%--                        <option value="温州">温州</option>--%>
<%--                        <option value="温州">台州</option>--%>
<%--                        <option value="温州">绍兴</option>--%>
<%--                    </select>--%>
<%--                </div>--%>
<%--            </div>--%>

<%--            <div class="layui-form-item" style="padding-left: 200px">--%>
<%--                <label class="layui-form-label">复选框</label>--%>
<%--                <div class="layui-input-block">--%>
<%--                    <input type="checkbox" name="like[write]" title="写作">--%>
<%--                    <input type="checkbox" name="like[read]" title="阅读" checked="">--%>
<%--                    <input type="checkbox" name="like[game]" title="游戏">--%>
<%--                </div>--%>
<%--            </div>--%>


<%--            <div class="layui-form-item" style="padding-left: 200px">--%>
<%--                <label class="layui-form-label">是否公开</label>--%>
<%--                <div class="layui-input-block">--%>
<%--                    <input type="checkbox" checked="" name="open" lay-skin="switch" lay-filter="switchTest" lay-text="ON|OFF">--%>
<%--                </div>--%>
<%--            </div>--%>
<%--            <div class="layui-form-item" style="padding-left: 200px">--%>
<%--                <label class="layui-form-label">单选框</label>--%>
<%--                <div class="layui-input-block">--%>
<%--                    <input type="radio" name="sex" value="男" title="男" checked="">--%>
<%--                    <input type="radio" name="sex" value="女" title="女">--%>
<%--                    <input type="radio" name="sex" value="禁" title="禁用" disabled="">--%>
<%--                </div>--%>
<%--            </div>--%>
            <div class="layui-form-item layui-form-text" style="padding-left: 200px">
                <label class="layui-form-label">内容</label>
                <div class="layui-input-block">
                    <textarea placeholder="请输入内容" name="textarea" class="layui-textarea" style="width: 500px"></textarea>
                </div>
            </div>
            <div class="layui-form-item" style="padding-left: 200px">
                <div class="layui-input-block">
                    <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary" style="margin-left: 200px">重置</button>
                </div>
            </div>
        </form>
    </div>
</div>
<script type="text/javascript" src="layui/layui.js"></script>
<script type="text/javascript">
    layui.use('element', function(){
        var element = layui.element; //导航的hover效果、二级菜单等功能，需要依赖element模块

        //监听导航点击
        element.on('nav(demo)', function(elem){
            //console.log(elem)
            layer.msg(elem.text());
        });
    });
</script>
<script>
    layui.use(['form', 'layedit', 'laydate'], function(){
        var form = layui.form
            ,layer = layui.layer
            ,layedit = layui.layedit
            ,laydate = layui.laydate;


        //表单赋值
        layui.$('#LAY-component-form-setval').on('click', function(){
            form.val('example', {
                "username": "" // "name": "value"
                ,"password": ""
                ,"interest": 1
                ,"like[write]": true //复选框选中状态
                ,"close": true //开关状态
                // ,"sex": "女"
                // ,"desc": "我爱 layui"
            });
        });

        //表单取值
        layui.$('#LAY-component-form-getval').on('click', function(){
            var data = form.val('example');
            alert(JSON.stringify(data));
        });

    });
</script>

</body>
</html>